package cn.bonoon.kernel.web.velocity;

import org.apache.velocity.app.VelocityEngine;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.view.velocity.VelocityConfigurer;

public class ResolvedVelocityConfigurer extends VelocityConfigurer{

	@Autowired
	private ResolvedResourceLoader resolvedResourceLoader;
	
	@Override
	protected void postProcessVelocityEngine(VelocityEngine velocityEngine) {
		super.postProcessVelocityEngine(velocityEngine);
		velocityEngine.addProperty(VelocityEngine.RESOURCE_LOADER, "resolved");
		velocityEngine.setProperty("resolved.resource.loader.class", ResolvedResourceLoader.class);
		velocityEngine.setProperty("resolved.resource.loader.instance", resolvedResourceLoader);
	}
}
